<template>
  <view class="page">
		<view class="header">
			<view class="locationName">
				<uni-icons type="home-filled" size="18" color="blue"></uni-icons>
				<text>河北医科大学第一医院</text>
			</view>
		</view>
		<view class="uni-search-bar">
			<uni-search-bar placeholder="搜索科室,医生" cancel-button="none" radius="100"/>
		</view>
		<view class="classify_wrap">
			<!-- 横向分类滚动开始 -->
			<!-- <view class="classify_scroll_x">
				<scroll-view scroll-x="true" >
					<view class="segmented-wrap">
						<uni-segmented-control :current="current" :values="classify" @clickItem="onClickItem" styleType="text" activeColor="#CC0000"></uni-segmented-control>
					</view>
				</scroll-view>
			</view> -->
			<!-- 横向分类滚动结束 -->
			<!-- <view class="classify_icon">
				 <uni-icons type="list" size="28" @click="goToGridPage" color="gray"></uni-icons>
			</view> -->
		</view>
		
		<view class="content">
			<view v-if="current === 0">
				<!-- 主页轮播图开始 -->
				<view class="uni-margin-wrap">
					<unicloud-db v-slot:default="{data, loading, error, options}" collection="opendb-banner">
						<view v-if="error">{{error.message}}</view>
						<view v-else>
							<swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration">
							  <swiper-item v-for="(item, index) in data" :key="item._id">
							    <view class="swiper-item">
							      <image class="banner-image" :src="item.bannerfile.url" mode="aspectFill" :draggable="false" />
							    </view>
							  </swiper-item>
							</swiper>
						</view>
					</unicloud-db>
				</view>
				<!-- 主页轮播图结束 -->
				<!-- 会员权益开始 -->
				<view >
					<uni-card >
						<!-- 权益列表开始 -->
						<uni-grid :column="number" :show-border="false" >
							<uni-grid-item >
								<view class="grid-item-box">
									<image src="../../static/tabbar/yy.png" class="image"></image>
								</view>
							</uni-grid-item>
							<uni-grid-item>
								<view class="grid-item-box">
									<image src="../../static/tabbar/wz.png" class="image"></image>
								</view>
							</uni-grid-item>
							<uni-grid-item>
								<view class="grid-item-box">
									<image src="../../static/tabbar/bg.png" class="image"></image>
								</view>
							</uni-grid-item>
						</uni-grid>
						<!-- 权益列表结束 -->
					</uni-card>
				</view>
				<!-- 会员权益结束 -->
				<uni-card  style="display: block;" class="uni-card" >
					<text class="uni-card">初次使用请添加就诊卡</text>
					<button type="primary" @click="add">添加就诊卡</button>
				</uni-card>
				<uni-card title="门诊服务"  >
					<uni-grid :column="4" :show-border="false" >
						<uni-grid-item >
							<view class="grid-item-box">
								<image src="../../static/tabbar/qiandao_1.png" class="img"></image>
								<text>门诊签到</text>
							</view>
						</uni-grid-item>
						<uni-grid-item >
							<view class="grid-item-box">
								<image src="../../static/tabbar/qiandao_2.png" class="img"></image>
								<text>医技签到</text>
							</view>
						</uni-grid-item>
						<uni-grid-item >
							<view class="grid-item-box">
								<image src="../../static/tabbar/houzhen.png" class="img"></image>
								<text>排队候诊</text>
							</view>
						</uni-grid-item>
						<uni-grid-item >
							<view class="grid-item-box">
								<image src="../../static/tabbar/daozhen.png" class="img"></image>
								<text>智能导诊</text>
							</view>
						</uni-grid-item>
						<uni-grid-item >
							<view class="grid-item-box">
								<image src="../../static/tabbar/jiaofei.png" class="img"></image>
								<text>门诊缴费</text>
							</view>
						</uni-grid-item>
						<uni-grid-item >
							<view class="grid-item-box">
								<image src="../../static/tabbar/chongzhi.png" class="img"></image>
								<text>门诊充值</text>
							</view>
						</uni-grid-item>
						<uni-grid-item >
							<view class="grid-item-box">
								<image src="../../static/tabbar/tuifei.png" class="img"></image>
								<text>充值退费</text>
							</view>
						</uni-grid-item>
						<uni-grid-item >
							<view class="grid-item-box">
								<image src="../../static/tabbar/fapiao.png" class="img"></image>
								<text>电子发票</text>
							</view>
						</uni-grid-item>
					</uni-grid>
				</uni-card>
				
			</view>
			
		</view>
		
	</view>
</template>

<script>
  export default {
    data() {
      return {
				current: 0,
				indicatorDots: true,
				autoplay: true,
				interval: 2000,
				duration: 500,
				number:3,
				
      }
    },
    methods: {
		onClickItem(e) {
			if (this.current !== e.currentIndex) {
				this.current = e.currentIndex
			}
		},
		 goToGridPage(){
			uni.navigateTo({
				url:'/pages/grid/grid'
		 })
		},
	}
  }
</script>

<style scoped>
	view {
		display: flex;
		box-sizing: border-box;
		flex-direction: column;
	}
	.page{
		background-color: #EEEEEE;
	}
	.header{
		display: flex;
		flex-direction: row;
		background-color: #FFFFFF;
	}
	.locationName{
		display: flex;
		flex-direction: row;
		height: 50px;
		line-height: 50px;
		font-size: 12px
	}
	.uni-search-bar{
		width: 750rpx;
		height: 50px;
	}
	.classify_wrap {
		width: 750rpx;
		display: flex;
		flex-direction: row;
	}
	.classify_scroll_x{
		white-space: nowrap;
		width: 650rpx;
		background-color: #FFFFFF;
		margin-top: 5rpx;
		margin-bottom: 8rpx;
	}
	.classify_icon{
		display: flex;
		flex: 1;
		background-color: #FFFFFF;
		margin-left: 3rpx;
		margin-top: 5rpx;
		margin-bottom: 8rpx;
	}
	.segmented-wrap{
		width: 1300rpx;
	}
	.scroll-view-item_H {
		display: inline-block;
		width: 140rpx;
		height: 90rpx;
		line-height: 90rpx;
		text-align: center;
		font-size: 12rpx;
	}
	.scroll-view-item_selected{
		border-bottom: 2px solid red;
	}
	.uni-margin-wrap{
		margin-top: 5rpx;
	}
	.swiper{
		height: 315rpx;
	}
	.banner-image {
		width: 750rpx;
		height: 315rpx;
	}
	.grid-item-box {
			flex: 1;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: top;
			padding:0px 0;
			position: relative;
			margin: 0px;
		}
		.image{
			height: 80px;
			width: 80px;
		}
		.img{
			height: 50px;
			width: 50px;
		}
		.uni-card{
			flex: 1;
			display:flex;
			flex-direction: column;
			align-items: center;
			justify-content: top;
			padding:0px 0;
			position: relative;
			margin: 0px;
		}
</style>